<%--
  Created by IntelliJ IDEA.
  User: houxianghua
  Date: 2015/10/8
  Time: 16:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/component/common.jsp" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="">
  <meta name="author" content="">
  <title></title>
  <%@include file="/WEB-INF/jsp/component/commonHead.jsp" %>
  <%@include file="/WEB-INF/jsp/component/commonBottom.jsp" %>
</head>
<%--<body onresize="reSizeParentIframe()" onload="reSizeParentIframe();">--%>
<body>
<div class="row">
  <div class="col-lg-12">
    <h1 class="page-header">医生列表</h1>
  </div>
  <!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
  <div class="col-lg-12">
    <div class="panel panel-default">
      <div class="panel-heading">
        姓名:<input type="text" id="drName" name="drName"/>
        <button id="query" class="mk_butt" >查询</button>
      </div>
      <!-- /.panel-heading -->
      <div class="panel-body">
        <div class="dataTable_wrapper">
          <table id="example" class="table table-striped table-bordered table-hover" width="100%">
            <thead>
            <tr align="left">
              <th>姓名</th>
              <th>从医编号</th>
              <th>职务</th>
            </tr>
            </thead>
            <tbody style="cursor: pointer">
            </tbody>
          </table>
        </div>
      </div>
      <!-- /.panel-body -->
    </div>
    <!-- /.panel -->
  </div>
  <!-- /.col-lg-12 -->
</div>

<script>
  var table;
  function initTable() {
    table = $("#example").DataTable({
      "dom": "<'row'<'col-xs-2'l><'#mytool.col-xs-10'><'col-xs-6'f>r>" +
      "t" +
      "<'row'<'col-xs-6'i><'col-xs-6'p>>",
      "bFilter": false,//去掉搜索框
      "bAutoWidth": true, //自适应宽度
      "sPaginationType" : "full_numbers",
      "ordering": false,//是否允许Datatables开启排序
      "bProcessing" : true,
      "bServerSide" : true,
      "sAjaxSource" : "${URL_ADM_FOLLOWUP_SEARCH_DOCTOR}",
      "sAjaxDataProp": "dataList",//查询后，返回的集合
      "fnServerData": function ( sSource, aoData, fnCallback ) {  //查询条件
        aoData.push(
                { "name": "drName", "value": $("#drName").val() }
        );
        $.ajax( {
          "dataType": 'json',
          "url": sSource,
          "type":'post',
          "data": aoData,
          "success": fnCallback
        } );

      },
      "aoColumns" : [ {
        "mDataProp" : "drName"
      }, {
        "mDataProp" : "drCode"
      }, {
        "mDataProp" : "position"
      }
      ],
      "oLanguage" : {
        "sProcessing" : "正在加载中......",
        "sLengthMenu" : "每页显示 _MENU_ 条记录",
        "sZeroRecords" : "没有数据！",
        "sEmptyTable" : "无数据存在！",
        "sInfo" : "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",
        "sInfoEmpty" : "显示0到0条记录",
        "sInfoFiltered" : "数据表中共为 _MAX_ 条记录",
        //"sSearch" : "搜索",
        "oPaginate" : {
          "sFirst" : "首页",
          "sPrevious" : "上一页",
          "sNext" : "下一页",
          "sLast" : "末页"
        }
      }
    });

    $('#example tbody').on( 'click', "td", function (e) {
      var rowData = table.row( $(this).parents('tr') ).data();
      window.location.href='${URL_ADM_FOLLOWUP_TOSEARCH_FOLLOWUP_PLAN}?doctorId=' +rowData.id;
    });
  }

  //查询
  $("#query").click(function() {
    refreshTable();
  });

  //刷新table数据
  function refreshTable(){
    table.ajax.reload();
    //重置全选按钮
    $("#all_id")[0].checked = false;
  }

  $(document).ready(function() {
    initTable();
  });
</script>
</body>
</html>